home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3436 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.3 KB

  1. Path: news1.h1.usa.pipeline.com!usenet
  2. From: grantp@usa.pipeline.com
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Using templates in BC++ 4.5
  5. Date: 24 Jan 1996 02:00:25 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4e43rp$cgb@news1.usa.pipeline.com>
  8. NNTP-Posting-Host: pipe12.h1.usa.pipeline.com
  9. X-PipeUser: grantp
  10. X-PipeHub: usa.pipeline.com
  11. X-PipeGCOS: (Pete)
  12. X-Newsreader: Pipeline USA v3.3.0
  13.  
  14. On Jan 23, 1996 11:26:21 in article <Using templates in BC++ 4.5>, 'John
  15. Leonard <leonardj@tribeca.ios.com>' wrote: 
  16.  
  17.  
  18. >I wrote a windows program, in BC++ 4.52, that uses class templates.  
  19. >The template declarations are in a header file and the function  
  20. >definitions are in a cpp file which includes the header file. The cpp  
  21. >file compiled fine, but the project window showed that the code size  
  22. >equaled zero and when I tried to build and link the entire project I got  
  23. >linker error messages that the member functions of the class were  
  24. >undefined. I then changed the code so that the classes weren't templates  
  25. >and the project was built and ran fine. My question is: how can I use  
  26. >class templates in my program? 
  27.  
  28. The simplest way with your system is to have all the template  
  29. code in header files so that the compiler can "see" the 
  30. template definitions whenever it needs them. 
  31. -- 
  32. Pete Grant 
  33. Kalevi, Inc. 
  34. Object Oriented Software Development
  35.